<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
  <cpn></cpn>
</div>
<!--template将组件的template抽离出来-->
<template id="cpn">
  <div>
    <h2>{{title}}</h2>
  </div>
</template>
<script src="../js/vue.js"></script>
<script>
  // component不加s
  // data option should be a function data不能是一个对象
  Vue.component('cpn', {
    template: '#cpn',
    // data是一个函数
    data () {
      return {
        title: "abab"
      }
    },
    components: {

    }
  })
  const app = new Vue({
    el: '#app',
    data: {
      message: "你好",
    }
  })
</script>
</body>
</html>
